#include<bits/stdc++.h>
using namespace std;
int a[1000001],b[1000001];
int main()
{
	int n,i,j,m,t,x,v;
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	cin>>n>>m;
	for(i=1;i<=n;i++)
	cin>>a[i];
	while(m>0)
	{
		cin>>t;
		if(t==1)
		{
			cin>>x>>v;
			a[x]=v;
		}
		else 
		{
			int s=1,x1;
			cin>>x;
			x1=x;
			for(i=1;i<=n;i++)
			b[i]=a[i];
			while(x1-1>=1)
			{
				if(b[x1-1]==b[x])
				{
					s++;
				}
				x1--;
			}
			sort(b+1,b+n+1);
			for(i=1;i<=n;i++)
			{
				if(b[i]==a[x])
				{
					cout<<i+s-1<<endl;
					break;
				}
			}
		}
		m--;
	}
	return 0;
	fclose(stdin);
	fclose(stdout);
}
